home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / amsalpha.bst < prev    next >
Text File  |  1991-06-30  |  28KB  |  1,349 lines

  1. %%bibtexfile{%
  2. %% filename="amsalpha.bst",
  3. %% version="1.1",
  4. %% date="21-JUN-1991",
  5. %% filetype="BibTeX: bibliography style",
  6. %% copyright="Copyright (C) American Mathematical Society, all rights
  7. %%   reserved.  Copying of this file is authorized only if either:
  8. %%   (1) you make absolutely no changes to your copy, including name;
  9. %%   OR (2) if you do make changes, you first rename it to some other
  10. %%   name.",
  11. %% author="American Mathematical Society",
  12. %% address="American Mathematical Society,
  13. %%   Technical Support Group,
  14. %%   P. O. Box 6248,
  15. %%   Providence, RI 02940,
  16. %%   USA",
  17. %% telephone="401-455-4080 or (in the USA) 800-321-4AMS",
  18. %% email="Internet: Tech-Support@Math.AMS.com",
  19. %% checksumtype="line count",
  20. %% checksum="1348",
  21. %% codetable="ISO/ASCII",
  22. %% keywords="latex, amslatex, ams-latex, bibtex",
  23. %% abstract="This file is part of the AMS-\LaTeX{} package, version 1.1.
  24. %%   It contains a bibliograpy style that produces \verb|\bibitem|'s
  25. %%   with letter labels."
  26. %%}
  27. %%% end of file header
  28. % This bibliography style must be used with 
  29. % BibTeX versions 0.99a or later, LaTeX version 2.09.
  30. % See the file btxbst.doc for extra documentation other than
  31. % what is included here.  And see btxhak.tex for a description
  32. % of the BibTeX language and how to use it.
  33.  
  34. % This defines the types of fields that can occur in a database entry
  35. % for this particular bibliography style.  Except for `language',
  36. % this is the standard list from alpha.bst.
  37.  
  38. %% Types of entries currently allowed in a BibTeX file:
  39. %% 
  40. %% ARTICLE -- An article from a journal or magazine.
  41. %% 
  42. %% BOOK -- A book with an explicit publisher.
  43. %% 
  44. %% BOOKLET -- A work that is printed and bound,
  45. %% but without a named publisher or sponsoring institution.
  46. %% 
  47. %% CONFERENCE -- The same as INPROCEEDINGS,
  48. %% included for Scribe compatibility.
  49. %% 
  50. %% INBOOK -- A part of a book,
  51. %% which may be a chapter (or section or whatever) and/or a range of pages.
  52. %% 
  53. %% INCOLLECTION -- A part of a book having its own title.
  54. %% 
  55. %% INPROCEEDINGS -- An article in a conference proceedings.
  56. %% 
  57. %% MANUAL -- Technical documentation.  
  58. %% 
  59. %% MASTERSTHESIS -- A Master's thesis.
  60. %% 
  61. %% MISC -- Use this type when nothing else fits.
  62. %% 
  63. %% PHDTHESIS -- A PhD thesis.
  64. %% 
  65. %% PROCEEDINGS -- The proceedings of a conference.
  66. %% 
  67. %% TECHREPORT -- A report published by a school or other institution,
  68. %% usually numbered within a series.
  69. %% 
  70. %% UNPUBLISHED -- A document having an author and title, but not formally
  71. %% published.
  72.  
  73. ENTRY
  74.   { address
  75.     author
  76.     booktitle
  77.     chapter
  78.     edition
  79.     editor
  80.     howpublished
  81.     institution
  82.     journal
  83.     key
  84.     language
  85.     month
  86.     note
  87.     number
  88.     organization
  89.     pages
  90.     publisher
  91.     school
  92.     series
  93.     title
  94.     type
  95.     volume
  96.     year
  97.   }
  98.   {}
  99.   { label extra.label sort.label }
  100.  
  101. % Removed after.sentence, after.block---not needed.
  102.  
  103. INTEGERS { output.state before.all mid.sentence }
  104.  
  105. FUNCTION {init.state.consts}
  106. { #0 'before.all :=
  107.   #1 'mid.sentence :=
  108. }
  109.  
  110. % Scratch variables:
  111.  
  112. STRINGS { s t }
  113.  
  114. % Utility functions
  115.  
  116. FUNCTION {shows}
  117. { duplicate$ "::::  `" swap$ * "'" * top$
  118. }
  119.  
  120. FUNCTION {showstack}
  121. {"STACK====================================================================="
  122. top$
  123. stack$
  124. "ENDSTACK=================================================================="
  125. top$
  126. }
  127.  
  128. FUNCTION {not}
  129. {   { #0 }
  130.     { #1 }
  131.   if$
  132. }
  133.  
  134. FUNCTION {and}
  135. {   'skip$
  136.     { pop$ #0 }
  137.   if$
  138. }
  139.  
  140. FUNCTION {or}
  141. {   { pop$ #1 }
  142.     'skip$
  143.   if$
  144. }
  145.  
  146. FUNCTION {field.or.null}
  147. { duplicate$ empty$
  148.     { pop$ "" }
  149.     'skip$
  150.   if$
  151. }
  152.  
  153. FUNCTION {emphasize}
  154. { duplicate$ empty$
  155.     { pop$ "" }
  156.     { "{\em " swap$ * "}" * }
  157.   if$
  158. }
  159.  
  160. % n.dashify is used to make sure page ranges get the TeX code
  161. % (two hyphens) for en-dashes.
  162.  
  163. FUNCTION {n.dashify}
  164. { 't :=
  165.   ""
  166.     { t empty$ not }
  167.     { t #1 #1 substring$ "-" =
  168.     { t #1 #2 substring$ "--" = not
  169.         { "--" *
  170.           t #2 global.max$ substring$ 't :=
  171.         }
  172.         {   { t #1 #1 substring$ "-" = }
  173.         { "-" *
  174.           t #2 global.max$ substring$ 't :=
  175.         }
  176.           while$
  177.         }
  178.       if$
  179.     }
  180.     { t #1 #1 substring$ *
  181.       t #2 global.max$ substring$ 't :=
  182.     }
  183.       if$
  184.     }
  185.   while$
  186. }
  187.  
  188. % tie.or.space.connect connects two items with a ~ if the
  189. % second item is less than 3 letters long, otherwise it just puts an 
  190. % ordinary space.
  191.  
  192. FUNCTION {tie.or.space.connect}
  193. { duplicate$ text.length$ #3 <
  194.     { "~" }
  195.     { " " }
  196.   if$
  197.   swap$ * *
  198. }
  199.  
  200. FUNCTION {add.space.if.necessary}
  201. { duplicate$ "" =
  202.     'skip$
  203.     { " " * }
  204.   if$
  205. }
  206.  
  207. % either.or.check gives a warning if two mutually exclusive fields
  208. % were used in the database.
  209.  
  210. FUNCTION {either.or.check}
  211. { empty$
  212.     'pop$
  213.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  214.   if$
  215. }
  216.  
  217. % output.nonnull is called by output.
  218.  
  219. FUNCTION {output.nonnull}
  220. % remove the top item from the stack because it's in the way.
  221. { 's :=
  222.   output.state mid.sentence =
  223. % If we're in mid-sentence, add a comma to the new top item and write it
  224.     { ", " * write$ }
  225. % Otherwise, if we're at the beginning of a bibitem,
  226.     { output.state before.all =
  227. % just write out the top item from the stack;
  228.       'write$
  229. % and the last alternative is that we're at the end of the current
  230. % bibitem, so we add a period to the top stack item and write it out.
  231.         { add.period$ " " * write$ }
  232.       if$
  233.       mid.sentence 'output.state :=
  234.     }
  235.   if$
  236. % Put the top item back on the stack that we removed earlier.
  237.   s
  238. }
  239.  
  240. % Output checks to see if the stack top is empty; if not, it
  241. % calls output.nonnull to write it out.
  242.  
  243. FUNCTION {output}
  244. { duplicate$ empty$
  245.     'pop$
  246.     'output.nonnull
  247.   if$
  248. }
  249.  
  250. % Output.check is like output except that it gives a warning on-screen
  251. % if the given field in the database entry is empty.  t is the field
  252. % name.
  253.  
  254. FUNCTION {output.check}
  255. { 't :=
  256.   duplicate$ empty$
  257.     { pop$ "empty " t * " in " * cite$ * warning$ }
  258.     'output.nonnull
  259.   if$
  260. }
  261.  
  262. FUNCTION {output.bibitem}
  263. { newline$
  264.   "\bibitem[" write$
  265.   label write$
  266.   "]{" write$
  267.   cite$ write$
  268.   "}" write$
  269.   newline$
  270. % This empty string is the first thing that will be written
  271. % the next time write$ is called.  Done this way because each
  272. % item is saved on the stack until we find out what punctuation
  273. % should be added after it.  Therefore we need an empty first item.
  274.   ""
  275.   before.all 'output.state :=
  276. }
  277.  
  278. FUNCTION {fin.entry}
  279. { add.period$
  280.   write$
  281.   newline$
  282. }
  283.  
  284. % Removed new.block, new.block.checka, new.block.checkb, new.sentence,
  285. % new.sentence.checka, and new.sentence.checkb functions here, since they
  286. % don't seem to be needed in the AMS style.  Also moved some real
  287. % basic functions like `and' and 'or' earlier in the file.
  288.  
  289. INTEGERS { nameptr namesleft numnames }
  290.  
  291. % The extra section to write out a language field was added
  292. % for AMSPLAIN.BST.  Not present in plain.bst.
  293.  
  294. FUNCTION {format.language}
  295. { language empty$
  296.     { "" }
  297.     { " (" language * ")" * }
  298.   if$
  299. }
  300.  
  301. % This version of format.names puts names in the format
  302. %
  303. % First von Last, Jr.
  304. %
  305. % (i.e., first name first, no abbreviating to initials).
  306.  
  307. FUNCTION {format.names}
  308. { 's :=
  309.   #1 'nameptr :=
  310.   s num.names$ 'numnames :=
  311.   numnames 'namesleft :=
  312.     { namesleft #0 > }
  313.     { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
  314.       nameptr #1 >
  315.     { namesleft #1 >
  316.         { ", " * t * }
  317.         { numnames #2 >
  318.         { "," * }
  319.         'skip$
  320.           if$
  321.           t "others" =
  322.         { " et~al." * }
  323.         { " and " * t * }
  324.           if$
  325.         }
  326.       if$
  327.     }
  328.     't
  329.       if$
  330.       nameptr #1 + 'nameptr :=
  331.       namesleft #1 - 'namesleft :=
  332.     }
  333.   while$
  334. }
  335.  
  336. FUNCTION {format.authors}
  337. { author empty$
  338.     { "" }
  339.     { extra.label "\bysame" =
  340.          {"\bysame"}
  341.          { author format.names }
  342.      if$
  343.     }
  344.   if$
  345. }
  346.  
  347. FUNCTION {format.editors}
  348. { editor empty$
  349.     { "" }
  350.     { editor format.names
  351.       editor num.names$ #1 >
  352.     { " (eds.)" * }
  353.     { " (ed.)" * }
  354.       if$
  355.     }
  356.   if$
  357. }
  358.  
  359. FUNCTION {format.nonauthor.editors}
  360. { editor empty$
  361.     { "" }
  362.     { editor format.names
  363.       editor num.names$ #1 >
  364.     { ", eds." * }
  365.     { ", ed." * }
  366.       if$
  367.     }
  368.   if$
  369. }
  370.  
  371. FUNCTION {format.title}
  372. { title empty$
  373.     { "" }
  374.     { title "t" change.case$ emphasize }
  375.   if$
  376. }
  377.  
  378. FUNCTION {format.journal.vol.year}
  379. { journal empty$
  380.     { "journal name missing in " cite$ * warning$ }
  381.     { journal
  382.       volume empty$ 
  383.         'skip$
  384.         { " {\bf " * volume * "}" * }
  385.       if$
  386.       year empty$
  387.         { "year missing in " cite$ * warning$ }
  388.         { " (" * year * ")" * }
  389.       if$
  390.     }
  391.   if$
  392. }
  393.  
  394. % For formatting the issue number for a journal article.
  395.  
  396. FUNCTION {format.number}
  397. { number empty$
  398.     { "" }
  399.     { "no.~" number * }
  400.   if$
  401. }
  402.  
  403. % For formatting miscellaneous dates
  404.  
  405. FUNCTION {format.date}
  406. { year empty$
  407.     { month empty$
  408.     { "" }
  409.     { "there's a month but no year in " cite$ * warning$
  410.       month
  411.     }
  412.       if$
  413.     }
  414.     { month empty$
  415.     'year
  416.     { month " " * year * }
  417.       if$
  418.     }
  419.   if$
  420. }
  421.  
  422. %%      The volume, series and number information is sort of tricky.
  423. %%      This code handles it as follows:
  424. %%      If the series is present, and the volume, but not the number,
  425. %%        then we do "{\em Book title}, Series Name, vol. 000"
  426. %%      If the series is present, and the number, but not the volume,
  427. %%        then we do "{\em Book title}, Series Name, no. 000"
  428. %%      If the series is present, and both number and volume,
  429. %%        then we do "{\em Book title}, vol. XX, Series Name, no. 000"
  430. %%      Finally, if the series is absent, 
  431. %%        then we do "{\em Book title}, vol. XX"
  432. %%        or         "{\em Book title}, no. 000"
  433. %%        and if both volume and number are present, give a warning message.
  434.  
  435. FUNCTION {format.bookvolume.series.number}
  436. { volume empty$
  437.     { "" % Push the empty string as a placeholder in case everything else
  438.          % is empty too.
  439.       series empty$
  440.         'skip$
  441.         { series } % if series is not empty put in stack
  442.       if$
  443.       number empty$
  444.         'skip$
  445.         { duplicate$ empty$ % if no preceding material,
  446.             'skip$          % do nothing, otherwise
  447.             { ", " * }      % add a comma and space to separate.
  448.           if$ 
  449.           "no." number tie.or.space.connect * % add the number information
  450.         }
  451.       if$
  452.     }
  453. %% If the volume is NOT EMPTY:
  454.     { "vol." volume tie.or.space.connect % vol. XX
  455.       number empty$
  456.         { series empty$
  457.             'skip$
  458.             { series ", " * swap$ *}    % Series Name, vol. XX
  459.           if$
  460.         }
  461.         { series empty$
  462.             { "can't use both volume and number if series info is missing" 
  463.               warning$
  464.               "in BibTeX entry type `" type$ * "'" * top$ 
  465.             }
  466.             { ", " * series * ", no." * number tie.or.space.connect }
  467.           if$
  468.         }
  469.       if$
  470.     }
  471.   if$
  472.  
  473. }  % end of format.bookvolume.series.number
  474.  
  475. %% format.inproc.title.where.editors is
  476. %% used by inproceedings and incollection entry types
  477.  
  478. FUNCTION {format.inproc.title.address.editors}
  479. { booktitle empty$
  480.     { "" }
  481. %%      No case changing or emphasizing for the title.  We want initial
  482. %%      caps, roman.
  483.     { booktitle } 
  484.   if$
  485. %%      We add parentheses around the address (place where conference
  486. %%      was held).
  487.   address empty$
  488.     'skip$
  489.     { add.space.if.necessary "(" * address * ")" * }
  490.   if$
  491. %%      Likewise we add parentheses around the editors' names.
  492.   editor empty$
  493.     'skip$
  494.     { add.space.if.necessary "(" * format.nonauthor.editors * ")" * }
  495.   if$
  496. }
  497.  
  498. % Desired output:
  499. %
  500. % Lecture Notes in Math., no.~1224
  501.  
  502. FUNCTION {format.number.series}
  503. { series empty$
  504.     { number empty$
  505.         { "" }
  506.         { "there's a number but no series in " cite$ * warning$ }
  507.       if$
  508.     }
  509.     { series 
  510.       number empty$
  511.         'skip$
  512.         { ", no.~" * number * }
  513.       if$
  514.     }
  515.   if$
  516. }
  517.  
  518. FUNCTION {format.edition}
  519. { edition empty$
  520.     { "" }
  521.     { output.state mid.sentence =
  522.     { edition "l" change.case$ " ed." * }
  523.     { edition "t" change.case$ " ed." * }
  524.       if$
  525.     }
  526.   if$
  527. }
  528.  
  529. INTEGERS { multiresult }
  530.  
  531. FUNCTION {multi.page.check}
  532. { 't :=
  533.   #0 'multiresult :=
  534.     { multiresult not
  535.       t empty$ not
  536.       and
  537.     }
  538.     { t #1 #1 substring$
  539.       duplicate$ "-" =
  540.       swap$ duplicate$ "," =
  541.       swap$ "+" =
  542.       or or
  543.     { #1 'multiresult := }
  544.     { t #2 global.max$ substring$ 't := }
  545.       if$
  546.     }
  547.   while$
  548.   multiresult
  549. }
  550.  
  551. FUNCTION {format.pages}
  552. { pages empty$
  553.     { "" }
  554.     { pages n.dashify }
  555.   if$
  556. }
  557.  
  558. FUNCTION {format.book.pages}
  559. { pages empty$
  560.     { "" }
  561.     { pages multi.page.check
  562.     { "pp.~" pages n.dashify * }
  563.     { "p.~" pages * }
  564.       if$
  565.     }
  566.   if$
  567. }
  568.  
  569. FUNCTION {format.chapter.pages}
  570. { chapter empty$
  571.     'format.pages
  572.     { type empty$
  573.     { "ch.~" }
  574.     { type "l" change.case$ " " * }
  575.       if$
  576.       chapter *
  577.       pages empty$
  578.     'skip$
  579.     { ", " * format.book.pages * }
  580.       if$
  581.     }
  582.   if$
  583. }
  584.  
  585. FUNCTION {empty.misc.check}
  586. { author empty$ title empty$ howpublished empty$
  587.   month empty$ year empty$ note empty$
  588.   and and and and and
  589.   key empty$ not and
  590.     { "all relevant fields are empty in " cite$ * warning$ }
  591.     'skip$
  592.   if$
  593. }
  594.  
  595. FUNCTION {format.thesis.type}
  596. { type empty$
  597.     'skip$
  598.     { pop$
  599.       type "t" change.case$
  600.     }
  601.   if$
  602. }
  603.  
  604. FUNCTION {format.tr.number}
  605. { type empty$
  606.     { "Tech. Report" }
  607.     'type
  608.   if$
  609.   number empty$
  610.     { "t" change.case$ }
  611.     { number tie.or.space.connect }
  612.   if$
  613. }
  614.  
  615. % The format.crossref functions haven't been paid much attention
  616. % at the present time (June 1990) and could probably use some
  617. % work.  MJD
  618.  
  619. FUNCTION {format.article.crossref}
  620. { key empty$
  621.     { journal empty$
  622.     { "need key or journal for " cite$ * " to crossref " * crossref *
  623.       warning$
  624.       ""
  625.     }
  626.     { "In " journal * }
  627.       if$
  628.     }
  629.     { "In " key * }
  630.   if$
  631.   " \cite{" * crossref * "}" *
  632. }
  633.  
  634. FUNCTION {format.crossref.editor}
  635. { editor #1 "{vv~}{ll}" format.name$
  636.   editor num.names$ duplicate$
  637.   #2 >
  638.     { pop$ " et~al." * }
  639.     { #2 <
  640.     'skip$
  641.     { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  642.         { " et~al." * }
  643.         { " and " * editor #2 "{vv~}{ll}" format.name$ * }
  644.       if$
  645.     }
  646.       if$
  647.     }
  648.   if$
  649. }
  650.  
  651. FUNCTION {format.book.crossref}
  652. { volume empty$
  653.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  654.       "In "
  655.     }
  656.     { "Vol." volume tie.or.space.connect
  657.       " of " *
  658.     }
  659.   if$
  660.   editor empty$
  661.   editor field.or.null author field.or.null =
  662.   or
  663.     { key empty$
  664.     { series empty$
  665.         { "need editor, key, or series for " cite$ * " to crossref " *
  666.           crossref * warning$
  667.           "" *
  668.         }
  669.         { series * }
  670.       if$
  671.     }
  672.     { key * }
  673.       if$
  674.     }
  675.     { format.crossref.editor * }
  676.   if$
  677.   " \cite{" * crossref * "}" *
  678. }
  679.  
  680. FUNCTION {format.incoll.inproc.crossref}
  681. { editor empty$
  682.   editor field.or.null author field.or.null =
  683.   or
  684.     { key empty$
  685.     { booktitle empty$
  686.         { "need editor, key, or booktitle for " cite$ * " to crossref " *
  687.           crossref * warning$
  688.           ""
  689.         }
  690.         { "In {\em " booktitle * "\/}" * }
  691.       if$
  692.     }
  693.     { "In " key * }
  694.       if$
  695.     }
  696.     { "In " format.crossref.editor * }
  697.   if$
  698.   " \cite{" * crossref * "}" *
  699. }
  700.  
  701. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  702.  
  703. % The main functions for each entry type.
  704.  
  705. % journal, vol and year are formatted together because they are
  706. % not separated by commas.
  707.  
  708. FUNCTION {article}
  709. { output.bibitem
  710.   format.authors "author" output.check
  711.   format.title "title" output.check
  712.   crossref missing$
  713.     { format.journal.vol.year "journal, volume, and year" output.check
  714.       format.number output
  715.       format.pages "pages" output.check
  716.     }
  717.     { format.article.crossref output.nonnull
  718.       format.pages output
  719.     }
  720.   if$
  721.   format.language *
  722.   note output
  723.   fin.entry
  724. }
  725.  
  726. FUNCTION {book}
  727. { output.bibitem
  728.   author empty$
  729.     { format.editors "author and editor" output.check }
  730.     { format.authors output.nonnull
  731.       crossref missing$
  732.     { "author and editor" editor either.or.check }
  733.     'skip$
  734.       if$
  735.     }
  736.   if$
  737.   format.title "title" output.check
  738.   format.edition output
  739.   crossref missing$
  740.     { format.bookvolume.series.number output
  741.       publisher "publisher" output.check
  742.       address output
  743.     }
  744.     { format.book.crossref output.nonnull
  745.     }
  746.   if$
  747.   format.date "year" output.check
  748.   format.language *
  749.   note output
  750.   fin.entry
  751. }
  752.  
  753. FUNCTION {booklet}
  754. { output.bibitem
  755.   format.authors output
  756.   format.title "title" output.check
  757.   howpublished output
  758.   address output
  759.   format.date output
  760.   note output
  761.   fin.entry
  762. }
  763.  
  764. FUNCTION {inbook}
  765. { output.bibitem
  766.   author empty$
  767.     { format.editors "author and editor" output.check }
  768.     { format.authors output.nonnull
  769.       crossref missing$
  770.     { "author and editor" editor either.or.check }
  771.     'skip$
  772.       if$
  773.     }
  774.   if$
  775.   title "title" output.check
  776.   crossref missing$
  777.     { format.bookvolume.series.number output
  778.       format.chapter.pages "chapter and pages" output.check
  779.       format.number.series output
  780.       publisher "publisher" output.check
  781.       address output
  782.     }
  783.     { format.chapter.pages "chapter and pages" output.check
  784.       format.book.crossref output.nonnull
  785.     }
  786.   if$
  787.   format.edition output
  788.   format.date "year" output.check
  789.   format.book.pages output
  790.   format.language *
  791.   note output
  792.   fin.entry
  793. }
  794.  
  795. FUNCTION {incollection}
  796. { output.bibitem
  797.   format.authors "author" output.check
  798.   format.title "title" output.check
  799.   crossref missing$
  800.     { format.inproc.title.address.editors "booktitle" output.check
  801.       format.bookvolume.series.number output
  802.       publisher "publisher" output.check
  803.       address output
  804.       format.edition output
  805.       format.date "year" output.check
  806.     }
  807.     { format.incoll.inproc.crossref output.nonnull
  808.     }
  809.   if$
  810.   note output
  811.   format.book.pages output
  812.   format.language *
  813.   fin.entry
  814. }
  815.  
  816. FUNCTION {inproceedings}
  817. { output.bibitem
  818.   format.authors "author" output.check
  819.   format.title "title" output.check
  820.   crossref missing$
  821.     { format.inproc.title.address.editors "booktitle" output.check
  822.       format.bookvolume.series.number output
  823.       organization output
  824.       publisher output
  825.       format.date "year" output.check
  826.     }
  827.     { format.incoll.inproc.crossref output.nonnull
  828.     }
  829.   if$
  830.   note output
  831.   format.book.pages output
  832.   format.language *
  833.   fin.entry
  834. }
  835.  
  836. FUNCTION {conference} { inproceedings }
  837.  
  838. FUNCTION {manual}
  839. { output.bibitem
  840.   author empty$
  841.     { organization empty$
  842.     'skip$
  843.     { organization output.nonnull
  844.       address output
  845.     }
  846.       if$
  847.     }
  848.     { format.authors output.nonnull }
  849.   if$
  850.   format.title "title" output.check
  851.   author empty$
  852.     { organization empty$
  853.     { address output }
  854.     'skip$
  855.       if$
  856.     }
  857.     { organization output
  858.       address output
  859.     }
  860.   if$
  861.   format.edition output
  862.   format.date output
  863.   note output
  864.   fin.entry
  865. }
  866.  
  867. FUNCTION {mastersthesis}
  868. { output.bibitem
  869.   format.authors "author" output.check
  870.   format.title "title" output.check
  871.   "Master's thesis" format.thesis.type output.nonnull
  872.   school "school" output.check
  873.   address output
  874.   format.date "year" output.check
  875.   note output
  876.   fin.entry
  877. }
  878.  
  879. FUNCTION {misc}
  880. { output.bibitem
  881.   format.authors output
  882.   format.title output
  883.   howpublished output
  884.   format.date output
  885.   note output
  886.   format.book.pages output
  887.   fin.entry
  888.   empty.misc.check
  889. }
  890.  
  891. FUNCTION {phdthesis}
  892. { output.bibitem
  893.   format.authors "author" output.check
  894.   format.title "title" output.check
  895.   "Ph.D. thesis" format.thesis.type output.nonnull
  896.   school "school" output.check
  897.   address output
  898.   format.date "year" output.check
  899.   note output
  900.   format.book.pages output
  901.   fin.entry
  902. }
  903.  
  904. FUNCTION {proceedings}
  905. { output.bibitem
  906.   editor empty$
  907.     { organization output }
  908.     { format.editors output.nonnull }
  909.   if$
  910.   format.title "title" output.check
  911.   format.bookvolume.series.number output
  912.   address empty$
  913.     { editor empty$
  914.         'skip$
  915.     { organization output }
  916.       if$
  917.       publisher output
  918.       format.date "year" output.check
  919.     }
  920.     { address output.nonnull
  921.       editor empty$
  922.     'skip$
  923.     { organization output }
  924.       if$
  925.       publisher output
  926.       format.date "year" output.check
  927.     }
  928.   if$
  929.   note output
  930.   fin.entry
  931. }
  932.  
  933. FUNCTION {techreport}
  934. { output.bibitem
  935.   format.authors "author" output.check
  936.   format.title "title" output.check
  937.   format.tr.number output.nonnull
  938.   institution "institution" output.check
  939.   address output
  940.   format.date "year" output.check
  941.   note output
  942.   fin.entry
  943. }
  944.  
  945. FUNCTION {unpublished}
  946. { output.bibitem
  947.   format.authors "author" output.check
  948.   format.title "title" output.check
  949.   note "note" output.check
  950.   format.date output
  951.   fin.entry
  952. }
  953.  
  954. FUNCTION {default.type} { misc }
  955.  
  956. MACRO {jan} {"January"}
  957.  
  958. MACRO {feb} {"February"}
  959.  
  960. MACRO {mar} {"March"}
  961.  
  962. MACRO {apr} {"April"}
  963.  
  964. MACRO {may} {"May"}
  965.  
  966. MACRO {jun} {"June"}
  967.  
  968. MACRO {jul} {"July"}
  969.  
  970. MACRO {aug} {"August"}
  971.  
  972. MACRO {sep} {"September"}
  973.  
  974. MACRO {oct} {"October"}
  975.  
  976. MACRO {nov} {"November"}
  977.  
  978. MACRO {dec} {"December"}
  979.  
  980. READ
  981.  
  982. FUNCTION {sortify}
  983. { purify$
  984.   "l" change.case$
  985. }
  986.  
  987. INTEGERS { len }
  988.  
  989. FUNCTION {chop.word}
  990. { 's :=
  991.   'len :=
  992.   s #1 len substring$ =
  993.     { s len #1 + global.max$ substring$ }
  994.     's
  995.   if$
  996. }
  997.  
  998. INTEGERS { et.al.char.used }
  999.  
  1000. FUNCTION {initialize.et.al.char.used}
  1001. { #0 'et.al.char.used :=
  1002. }
  1003.  
  1004. EXECUTE {initialize.et.al.char.used}
  1005.  
  1006. FUNCTION {format.lab.names}
  1007. { 's :=
  1008.   s num.names$ 'numnames :=
  1009.   numnames #1 >
  1010.     { numnames #4 >
  1011.     { #3 'namesleft := }
  1012.     { numnames 'namesleft := }
  1013.       if$
  1014.       #1 'nameptr :=
  1015.       ""
  1016.     { namesleft #0 > }
  1017.     { nameptr numnames =
  1018.         { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  1019.         { "{\etalchar{+}}" *
  1020.           #1 'et.al.char.used :=
  1021.         }
  1022.         { s nameptr "{v{}}{l{}}" format.name$ * }
  1023.           if$
  1024.         }
  1025.         { s nameptr "{v{}}{l{}}" format.name$ * }
  1026.       if$
  1027.       nameptr #1 + 'nameptr :=
  1028.       namesleft #1 - 'namesleft :=
  1029.     }
  1030.       while$
  1031.       numnames #4 >
  1032.     { "{\etalchar{+}}" *
  1033.       #1 'et.al.char.used :=
  1034.     }
  1035.     'skip$
  1036.       if$
  1037.     }
  1038.     { s #1 "{v{}}{l{}}" format.name$
  1039.       duplicate$ text.length$ #2 <
  1040.     { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
  1041.     'skip$
  1042.       if$
  1043.     }
  1044.   if$
  1045. }
  1046.  
  1047. FUNCTION {author.key.label}
  1048. { author empty$
  1049.     { key empty$
  1050.     { cite$ #1 #3 substring$ }
  1051.     { key #3 text.prefix$ }
  1052.       if$
  1053.     }
  1054.     { author format.lab.names }
  1055.   if$
  1056. }
  1057.  
  1058. FUNCTION {author.editor.key.label}
  1059. { author empty$
  1060.     { editor empty$
  1061.     { key empty$
  1062.         { cite$ #1 #3 substring$ }
  1063.         { key #3 text.prefix$ }
  1064.       if$
  1065.     }
  1066.     { editor format.lab.names }
  1067.       if$
  1068.     }
  1069.     { author format.lab.names }
  1070.   if$
  1071. }
  1072.  
  1073. FUNCTION {author.key.organization.label}
  1074. { author empty$
  1075.     { key empty$
  1076.     { organization empty$
  1077.         { cite$ #1 #3 substring$ }
  1078.         { "The " #4 organization chop.word #3 text.prefix$ }
  1079.       if$
  1080.     }
  1081.     { key #3 text.prefix$ }
  1082.       if$
  1083.     }
  1084.     { author format.lab.names }
  1085.   if$
  1086. }
  1087.  
  1088. FUNCTION {editor.key.organization.label}
  1089. { editor empty$
  1090.     { key empty$
  1091.     { organization empty$
  1092.         { cite$ #1 #3 substring$ }
  1093.         { "The " #4 organization chop.word #3 text.prefix$ }
  1094.       if$
  1095.     }
  1096.     { key #3 text.prefix$ }
  1097.       if$
  1098.     }
  1099.     { editor format.lab.names }
  1100.   if$
  1101. }
  1102.  
  1103. FUNCTION {calc.label}
  1104. { type$ "book" =
  1105.   type$ "inbook" =
  1106.   or
  1107.     'author.editor.key.label
  1108.     { type$ "proceedings" =
  1109.     'editor.key.organization.label
  1110.     { type$ "manual" =
  1111.         'author.key.organization.label
  1112.         'author.key.label
  1113.       if$
  1114.     }
  1115.       if$
  1116.     }
  1117.   if$
  1118.   duplicate$
  1119.   year field.or.null purify$ #-1 #2 substring$
  1120.   *
  1121.   'label :=
  1122.   year field.or.null purify$ #-1 #4 substring$
  1123.   *
  1124.   sortify 'sort.label :=
  1125. }
  1126.  
  1127. FUNCTION {sort.format.names}
  1128. { 's :=
  1129.   #1 'nameptr :=
  1130.   ""
  1131.   s num.names$ 'numnames :=
  1132.   numnames 'namesleft :=
  1133.     { namesleft #0 > }
  1134.     { nameptr #1 >
  1135.     { "   " * }
  1136.     'skip$
  1137.       if$
  1138.       s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
  1139.       nameptr numnames = t "others" = and
  1140.     { "et al" * }
  1141.     { t sortify * }
  1142.       if$
  1143.       nameptr #1 + 'nameptr :=
  1144.       namesleft #1 - 'namesleft :=
  1145.     }
  1146.   while$
  1147. }
  1148.  
  1149. FUNCTION {sort.format.title}
  1150. { 't :=
  1151.   "A " #2
  1152.     "An " #3
  1153.       "The " #4 t chop.word
  1154.     chop.word
  1155.   chop.word
  1156.   sortify
  1157.   #1 global.max$ substring$
  1158. }
  1159.  
  1160. FUNCTION {author.sort}
  1161. { author empty$
  1162.     { key empty$
  1163.     { "to sort, need author or key in " cite$ * warning$
  1164.       ""
  1165.     }
  1166.     { key sortify }
  1167.       if$
  1168.     }
  1169.     { author sort.format.names }
  1170.   if$
  1171. }
  1172.  
  1173. FUNCTION {author.editor.sort}
  1174. { author empty$
  1175.     { editor empty$
  1176.     { key empty$
  1177.         { "to sort, need author, editor, or key in " cite$ * warning$
  1178.           ""
  1179.         }
  1180.         { key sortify }
  1181.       if$
  1182.     }
  1183.     { editor sort.format.names }
  1184.       if$
  1185.     }
  1186.     { author sort.format.names }
  1187.   if$
  1188. }
  1189.  
  1190. FUNCTION {author.organization.sort}
  1191. { author empty$
  1192.     { organization empty$
  1193.     { key empty$
  1194.         { "to sort, need author, organization, or key in " cite$ * warning$
  1195.           ""
  1196.         }
  1197.         { key sortify }
  1198.       if$
  1199.     }
  1200.     { "The " #4 organization chop.word sortify }
  1201.       if$
  1202.     }
  1203.     { author sort.format.names }
  1204.   if$
  1205. }
  1206.  
  1207. FUNCTION {editor.organization.sort}
  1208. { editor empty$
  1209.     { organization empty$
  1210.     { key empty$
  1211.         { "to sort, need editor, organization, or key in " cite$ * warning$
  1212.           ""
  1213.         }
  1214.         { key sortify }
  1215.       if$
  1216.     }
  1217.     { "The " #4 organization chop.word sortify }
  1218.       if$
  1219.     }
  1220.     { editor sort.format.names }
  1221.   if$
  1222. }
  1223.  
  1224. FUNCTION {presort}
  1225. { calc.label
  1226.   sort.label
  1227.   "    "
  1228.   *
  1229.   type$ "book" =
  1230.   type$ "inbook" =
  1231.   or
  1232.     'author.editor.sort
  1233.     { type$ "proceedings" =
  1234.     'editor.organization.sort
  1235.     { type$ "manual" =
  1236.         'author.organization.sort
  1237.         'author.sort
  1238.       if$
  1239.     }
  1240.       if$
  1241.     }
  1242.   if$
  1243.   *
  1244.   "    "
  1245.   *
  1246.   year field.or.null sortify
  1247.   *
  1248.   "    "
  1249.   *
  1250.   title field.or.null
  1251.   sort.format.title
  1252.   *
  1253.   #1 entry.max$ substring$
  1254.   'sort.key$ :=
  1255. }
  1256.  
  1257. ITERATE {presort}
  1258.  
  1259. SORT
  1260.  
  1261. STRINGS { longest.label last.sort.label next.extra }
  1262.  
  1263. INTEGERS { longest.label.width last.extra.num }
  1264.  
  1265. FUNCTION {initialize.longest.label}
  1266. { "" 'longest.label :=
  1267.   #0 int.to.chr$ 'last.sort.label :=
  1268.   "" 'next.extra :=
  1269.   #0 'longest.label.width :=
  1270.   #0 'last.extra.num :=
  1271. }
  1272.  
  1273. FUNCTION {forward.pass}
  1274. { last.sort.label sort.label =
  1275.     { last.extra.num #1 + 'last.extra.num :=
  1276.       last.extra.num int.to.chr$ 'extra.label :=
  1277.     }
  1278.     { "a" chr.to.int$ 'last.extra.num :=
  1279.       "" 'extra.label :=
  1280.       sort.label 'last.sort.label :=
  1281.     }
  1282.   if$
  1283. }
  1284.  
  1285. FUNCTION {reverse.pass}
  1286. { next.extra "b" =
  1287.     { "a" 'extra.label := }
  1288.     'skip$
  1289.   if$
  1290.   label extra.label * 'label :=
  1291.   label width$ longest.label.width >
  1292.     { label 'longest.label :=
  1293.       label width$ 'longest.label.width :=
  1294.     }
  1295.     'skip$
  1296.   if$
  1297.   extra.label 'next.extra :=
  1298. }
  1299.  
  1300. EXECUTE {initialize.longest.label}
  1301.  
  1302. ITERATE {forward.pass}
  1303.  
  1304. REVERSE {reverse.pass}
  1305.  
  1306. FUNCTION {begin.bib}
  1307. { et.al.char.used
  1308.     { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ }
  1309.     'skip$
  1310.   if$
  1311.   preamble$ empty$
  1312.     'skip$
  1313.     { preamble$ write$ newline$ }
  1314.   if$
  1315.   "\ifx\undefined\bysame" write$ newline$
  1316.   "\newcommand{\bysame}{\leavevmode\hbox to3em{\hrulefill}\,}"
  1317.        write$ newline$
  1318.   "\fi" write$ newline$
  1319.   "\begin{thebibliography}{"  longest.label  * "}" * write$ newline$
  1320. }
  1321.  
  1322. EXECUTE {begin.bib}
  1323.  
  1324. EXECUTE {init.state.consts}
  1325.  
  1326. ITERATE {call.type$}
  1327.  
  1328. FUNCTION {end.bib}
  1329. { newline$
  1330.   "\end{thebibliography}" write$ newline$
  1331. }
  1332.  
  1333. EXECUTE {end.bib}
  1334. %% \CharacterTable
  1335. %%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
  1336. %%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
  1337. %%   Digits        \0\1\2\3\4\5\6\7\8\9
  1338. %%   Exclamation   \!     Double quote  \"     Hash (number) \#
  1339. %%   Dollar        \$     Percent       \%     Ampersand     \&
  1340. %%   Acute accent  \'     Left paren    \(     Right paren   \)
  1341. %%   Asterisk      \*     Plus          \+     Comma         \,
  1342. %%   Minus         \-     Point         \.     Solidus       \/
  1343. %%   Colon         \:     Semicolon     \;     Less than     \<
  1344. %%   Equals        \=     Greater than  \>     Question mark \?
  1345. %%   Commercial at \@     Left bracket  \[     Backslash     \\
  1346. %%   Right bracket \]     Circumflex    \^     Underscore    \_
  1347. %%   Grave accent  \`     Left brace    \{     Vertical bar  \|
  1348. %%   Right brace   \}     Tilde         \~}
  1349.